Skip to content

fix(test-app): handle sign-in cancellation and duplicate taps - #4711

Merged
thymikee merged 1 commit into
mainfrom
t3/oauth-fixture-sheet-status
Nov 18, 2026
Merged

thymikee merged 1 commit into
mainfrom
t3/oauth-fixture-sheet-status

Conversation

@thymikee

@thymikee thymikee commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Preserve cancellation and single presentation in the hosted sign-in fixture added in #4708. Expo sends ERR_AUTH_SESSION_CANCELED on the rejection's code. A synchronous guard prevents a second tap from calling the native module while the first sheet is active, and clears when that attempt finishes. One fixture screen changes.

Addresses both Apex findings on #4708 (cancellation, duplicate taps).

Validation

  • A host probe executed the screen handler with a stub native promise and called the same rendered handler twice before either call settled. At 806f73c, it called the module twice and rendered error for the Expo cancellation. At 991325f, it called once, rendered canceled, accepted a new tap after cancellation, and distinguished a genuine error.
  • Fixture typecheck and diff checks passed at 991325f. The same patch on the original PR head passed formatting, the repository build, and simulator app repack. GitHub validates this commit.
  • Live sheet cancellation remains unverified. The T3 device inventory did not expose the disposable simulator, so the repacked app was not installed or run.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.40 MB 6.40 MB 0 B
Package (unpacked) 6.40 MB 6.40 MB 0 B
Package (download) 1.94 MB 1.94 MB -5 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 35.6 ms 36.6 ms +1.0 ms
CLI --help 80.3 ms 73.6 ms -6.7 ms

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 991325f

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
examples/test-app/src/screens/AuthSessionLabScreen.tsx:33 Cancellation still renders "error": the native module sets no error code

Reviewed with this repository's own Sentinel configuration (7c1934fc035d).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 991325f. The verdict and the full list are in the summary comment.

Comment on lines +33 to +37
const canceled =
typeof error === 'object' &&
error !== null &&
'code' in error &&
error.code === 'ERR_AUTH_SESSION_CANCELED';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Minor · Cancellation still renders "error": the native module sets no error code

User taps SIGN IN then dismisses the sheet: the Swift module rejects with Exception(name: "AuthSessionCanceled", description: ...) and never supplies a code:, so error.code === 'ERR_AUTH_SESSION_CANCELED' is false and the screen renders error. Expo populates code only from a code: parameter on Exception; a name-only Exception surfaces its name on error.name, not as an ERR_* code.

Suggested change
const canceled =
typeof error === 'object' &&
error !== null &&
'code' in error &&
error.code === 'ERR_AUTH_SESSION_CANCELED';
const canceled =
(typeof error === 'object' &&
error !== null &&
'code' in error &&
error.code === 'ERR_AUTH_SESSION_CANCELED') ||
(error instanceof Error && error.name === 'AuthSessionCanceled');
Details

persona: senior-developer, javascript

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apex-sentinel-staging pivot The pinned Expo version derives a code when Exception has a name and no explicit code. In expo-modules-core@58.0.3, Exception.code returns customCode ?? errorCodeFromString(name). I compiled Expo's unchanged Swift sources and passed the fixture's name-only exception through any Error and then any JavaScriptThrowable. It yielded ERR_AUTH_SESSION_CANCELED. The pinned expo-modules-jsi@58.0.2 async promise rejection calls JavaScriptError.from, which sets the JS Error's code from that witness. The screen's code check matches that path, so an error.name fallback would add a second contract without evidence. This verifies the pinned bridge source and the Swift code witness. Live dismissal is still unverified.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 18, 2026
@thymikee

Copy link
Copy Markdown
Member Author

I reviewed 991325f and found no problems in the code, so the change looks ready. Not blocking, and you can take or leave these: the screen matches the hardcoded ERR_AUTH_SESSION_CANCELED string, which Expo derives from the Swift exception name, so you could pass an explicit code to the Swift Exception and keep the constant next to startFixtureSignInSession; no committed test covers the cancel mapping or the double tap, so if this lane reaches CI, extend the Maestro flow with a cancel and a double tap; and the typeof / 'code' in error narrowing is fine for a plain native Error, though a small isCodedRejection helper would help if a second screen needs it.

There are no conflicts. Smoke Tests (ios), iOS Release and a review check were still running when I posted, and none has failed. The diff only touches a fixture screen under examples/test-app/src, so a failure there is unlikely to come from this change, but check the excerpt against that path if one fails.

@thymikee
thymikee merged commit 6d20288 into main Nov 18, 2026
19 checks passed
@thymikee
thymikee deleted the t3/oauth-fixture-sheet-status branch November 18, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant